{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 读取yaml文件\n",
    "import yaml\n",
    "# js yaml\n",
    "file_path = './llama2-7b-chat-js.yaml'\n",
    "model_name_list = ['Qwen-7B-Chat', 'Qwen1.5-7B-Chat', 'Qwen2-7B-Instruct', 'Qwen2.5-7B-Instruct']\n",
    "def create_yaml(file_path, model_name_list):\n",
    "    with open(file_path, 'r') as f:\n",
    "        hparams = yaml.load(f, Loader=yaml.FullLoader)\n",
    "\n",
    "    for model_name in model_name_list:\n",
    "        hparams['model_name'] = hparams['model_name'].replace('llama2-7b-chat', f'qwen/{model_name}')\n",
    "        file_path_new = file_path.replace('llama2-7b-chat', model_name)\n",
    "        with open(file_path_new, 'w') as f:\n",
    "            yaml.dump(hparams, f)\n",
    "\n",
    "# create_yaml(file_path, model_name_list)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "file_path = './llama2-7b-chat-kl.yaml'\n",
    "model_name_list_qwen1_5 = ['Qwen1.5-0.5B-Chat', 'Qwen1.5-1.8B-Chat', 'Qwen1.5-4B-Chat']\n",
    "create_yaml(file_path, model_name_list_qwen1_5)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "ke2torch23cu121",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.19"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
